package cn.alpha.open.autocode.model;

public enum DataTypeMap {

	TINYINT("Integer"),
	SMALLINT("Integer"),
	MEDIUMINT("Long"),
	INTEGER("Long"),
	INT("Long"),
	BIGINT("Long"),
	FLOAT("Double"),
	DOUBLE("Double"),
	DECIMAL("Double"),
	CHAR("String"),
	VARCHAR("String"),
	TINYBLOB("String"),
	TINYTEXT("String"),
	BLOB("String"),
	TEXT("String"),
	MEDIUMBLOB("String"),
	MEDIUMTEXT("String"),
	LOGNGBLOB("String"),
	LONGTEXT("String"),
	VARBINARY("String"),
	BINARY("String"),
	DATE("java.util.Date"),
	TIME("java.util.Date"),
	YEAR("java.util.Date"),
	DATETIME("java.util.Date"),
	TIMESTAMP("java.util.Date");
	
	public static String getDataTypeName(String dataType)
	{
		for(DataTypeMap map:DataTypeMap.values())
		{
			if(dataType.toUpperCase().startsWith(map.name()))
				return map.getJavaDataTypeName();
		}
		return "";
	}
	
	private String javaDataTypeName;
	private DataTypeMap(String javaDataTypeName)
	{
		this.javaDataTypeName=javaDataTypeName;
	}
	public String getJavaDataTypeName() {
		return javaDataTypeName;
	}
	public void setJavaDataTypeName(String javaDataTypeName) {
		this.javaDataTypeName = javaDataTypeName;
	}
}
